package com.atguigu.gmall.item.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**初始化线程池
 * @author Jia Fa
 * @create 2021-12-15 17:52
 */
@Configuration
public class ThreadPoolConfig {

    @Bean
    public ExecutorService executorService() {
        return new ThreadPoolExecutor(100, 200, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(200), Executors.defaultThreadFactory(),
                (Runnable r, ThreadPoolExecutor executor) -> {
                    System.out.println("异步任务失败");
                });
    }
}
